package View.GUI;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;

import javax.swing.JPanel;

import Utils.ActionButton;
import Utils.ButtonImage;
import Utils.MediaUploder;

public class GameMenuPanel extends JPanel{

	ButtonImage exit_;
	MediaUploder media_;
	
	public GameMenuPanel(MediaUploder media){
		setLayout(null);
		setOpaque(false);
		
		setSize(100, 40);
		setLocation(0, 520);
		
		media_ = media;
		exit_ = new ButtonImage(this, media.exitMenu, media.exitMenu, 0, 0);
		exit_.addActionButton(new ActionButton() {
			
			@Override
			public void exitAction() {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void enterAction() {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void click(MouseEvent paramMouseEvent) {
				// TODO Auto-generated method stub
				media_.music_.halt();
				System.exit(0);
			}
		});
		
		addMouseListener(exit_);
		
		setVisible(true);
	}
	
	public void paintComponent(Graphics g){
		super.paintComponents(g);
		g.setColor( new Color( 240, 230, 140, 0) );
		g.fillRect( 0, 0, getWidth(), getHeight() );
		exit_.draw(g);
	}
	
}
